'use strict';

const defaultConfig = {
  name: 'app_config',
  version: '0.0.1',
  description: 'global app config for backend endpoint, cdn paths and etc.'
};

const localConfig = {
  env: 'local',
  endPoint: 'https://store-rest-dev.hypereal.com/rest/api',
  oauthEndPoint: 'https://store-rest-dev.hypereal.com/rest',
  "clientId": "104fd839267df301f69addee067a9cee1d0d1341bfed375fa4e9c8df51171250",
  "secret": "d909a6315b08493ae3a7f59bfa7526e2b13cc74c6470002a07b48707a5e7a5b4",
};

const devConfig = {
  env: 'development',
  endPoint: 'https://store-rest-dev.hypereal.com/rest/api',
  oauthEndPoint: 'https://store-rest-dev.hypereal.com/rest',
  "clientId": "104fd839267df301f69addee067a9cee1d0d1341bfed375fa4e9c8df51171250",
  "secret": "d909a6315b08493ae3a7f59bfa7526e2b13cc74c6470002a07b48707a5e7a5b4",
};

const stgConfig = {
  env: 'staging',
  endPoint: 'https://store-rest-staging.hypereal.com/rest/api',
  oauthEndPoint: 'https://store-rest-staging.hypereal.com/rest',
  "clientId": "c5a6fe542ccdf56bc8cec67ed9fb7df8f1784084a4fe17a50a8a978674ec21bc",
  "secret": "9c36e08dfa598820a468f8adeb495d2bac4323455663f78a220044b4bbda81ea",
};

const prodConfig = {
  env: 'production',
  endPoint: 'https://store.hypereal.com/rest/api',
  "clientId": "c5a6fe542ccdf56bc8cec67ed9fb7df8f1784084a4fe17a50a8a978674ec21bc",
  "secret": "9c36e08dfa598820a468f8adeb495d2bac4323455663f78a220044b4bbda81ea",
  imgPath: 'http://imgcdn.hypereal.com/oss-test/assets/images',
  oauthEndPoint: 'https://store.hypereal.com/rest'
};

let compiledConfig = {};

const env = process.env.NODE_ENV;

switch (env) {
  case 'dev':
  case 'development':
    compiledConfig = Object.assign({}, defaultConfig, devConfig);
    break;
  case 'stg':
  case 'staging':
    compiledConfig = Object.assign({}, defaultConfig, stgConfig);
    break;
  case 'prod':
  case 'production':
    compiledConfig = Object.assign({}, defaultConfig, prodConfig);
    break;
  default:
    compiledConfig = Object.assign({}, defaultConfig, localConfig);
}

module.exports = compiledConfig;